package com.zyh.em.evaluate;

import com.zyh.em.entity.EvaluateData;
import com.zyh.em.entity.EvaluateReport;
import com.zyh.em.entity.HistoryData;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class EvaluateChain {
    //包含多个evaluate节点
    private List<AbstractEvaluate> list = new ArrayList<>();

    public void addEvaluate(AbstractEvaluate... evaluates){
            if (evaluates!=null){
                Collections.addAll(list,evaluates);
            }
    }

    private int index = 0;

    public void doEvaluate(EvaluateData evaluateData, HistoryData historyData, EvaluateReport evaluateReport){
        if (index < list.size()){
            AbstractEvaluate abstractEvaluate = list.get(index);
            index++;
            abstractEvaluate.evaluate(evaluateData, historyData, evaluateReport,this);
        }
    }
}
